<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="module-filecmp.html" />
<link rel="parent" href="module-filecmp.html" />
<link rel="next" href="module-tempfile.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>11.5.1 The dircmp class </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.5 filecmp  "
  href="module-filecmp.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="11.5 filecmp  "
  href="module-filecmp.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="11.6 tempfile  "
  href="module-tempfile.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-filecmp.html">11.5 filecmp  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-filecmp.html">11.5 filecmp  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-tempfile.html">11.6 tempfile  </a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION0013510000000000000000"></a><a name="dircmp-objects"></a>
<br>
11.5.1 The <tt class="class">dircmp</tt> class 
</h2>

<p>
<tt class="class">dircmp</tt> instances are built using this constructor:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-2250' xml:id='l2h-2250' class="class">dircmp</tt></b>(</nobr></td>
  <td><var>a, b</var><big>[</big><var>, ignore</var><big>[</big><var>, hide</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Construct a new directory comparison object, to compare the
directories <var>a</var> and <var>b</var>. <var>ignore</var> is a list of names to
ignore, and defaults to <code>['RCS', 'CVS', 'tags']</code>. <var>hide</var> is a
list of names to hide, and defaults to <code>[os.curdir, os.pardir]</code>.
</dl>

<p>
The <tt class="class">dircmp</tt> class provides the following methods:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-2251' xml:id='l2h-2251' class="method">report</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Print (to <code>sys.stdout</code>) a comparison between <var>a</var> and <var>b</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-2252' xml:id='l2h-2252' class="method">report_partial_closure</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Print a comparison between <var>a</var> and <var>b</var> and common immediate
subdirectories.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-2253' xml:id='l2h-2253' class="method">report_full_closure</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Print a comparison between <var>a</var> and <var>b</var> and common 
subdirectories (recursively).
</dl>

<p>
The <tt class="class">dircmp</tt> offers a number of interesting attributes that may
be used to get various bits of information about the directory trees
being compared.

<p>
Note that via <tt class="method">__getattr__()</tt> hooks, all attributes are
computed lazily, so there is no speed penalty if only those
attributes which are lightweight to compute are used.

<p>
<dl><dt><b><tt id='l2h-2254' xml:id='l2h-2254' class="member">left_list</tt></b></dt>
<dd>
Files and subdirectories in <var>a</var>, filtered by <var>hide</var> and
<var>ignore</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2255' xml:id='l2h-2255' class="member">right_list</tt></b></dt>
<dd>
Files and subdirectories in <var>b</var>, filtered by <var>hide</var> and
<var>ignore</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2256' xml:id='l2h-2256' class="member">common</tt></b></dt>
<dd>
Files and subdirectories in both <var>a</var> and <var>b</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2257' xml:id='l2h-2257' class="member">left_only</tt></b></dt>
<dd>
Files and subdirectories only in <var>a</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2258' xml:id='l2h-2258' class="member">right_only</tt></b></dt>
<dd>
Files and subdirectories only in <var>b</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2259' xml:id='l2h-2259' class="member">common_dirs</tt></b></dt>
<dd>
Subdirectories in both <var>a</var> and <var>b</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2260' xml:id='l2h-2260' class="member">common_files</tt></b></dt>
<dd>
Files in both <var>a</var> and <var>b</var>
</dl>

<p>
<dl><dt><b><tt id='l2h-2261' xml:id='l2h-2261' class="member">common_funny</tt></b></dt>
<dd>
Names in both <var>a</var> and <var>b</var>, such that the type differs between
the directories, or names for which <tt class="function">os.stat()</tt> reports an
error.
</dl>

<p>
<dl><dt><b><tt id='l2h-2262' xml:id='l2h-2262' class="member">same_files</tt></b></dt>
<dd>
Files which are identical in both <var>a</var> and <var>b</var>.
</dl>

<p>
<dl><dt><b><tt id='l2h-2263' xml:id='l2h-2263' class="member">diff_files</tt></b></dt>
<dd>
Files which are in both <var>a</var> and <var>b</var>, whose contents differ.
</dl>

<p>
<dl><dt><b><tt id='l2h-2264' xml:id='l2h-2264' class="member">funny_files</tt></b></dt>
<dd>
Files which are in both <var>a</var> and <var>b</var>, but could not be
compared.
</dl>

<p>
<dl><dt><b><tt id='l2h-2265' xml:id='l2h-2265' class="member">subdirs</tt></b></dt>
<dd>
A dictionary mapping names in <tt class="member">common_dirs</tt> to
<tt class="class">dircmp</tt> objects.
</dl>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="11.5 filecmp  "
  href="module-filecmp.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="11.5 filecmp  "
  href="module-filecmp.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="11.6 tempfile  "
  href="module-tempfile.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-filecmp.html">11.5 filecmp  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-filecmp.html">11.5 filecmp  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-tempfile.html">11.6 tempfile  </a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
